import { ref } from 'vue';
import { defineStore } from "pinia";

export const useGlobalStore = defineStore('global', {
	state: () => {
        return {
            media_btn: ref<boolean>(false),
            upload_model: ref<boolean>(false),
            location: ref<number>(1), // 1 网盘，2 媒资
            wangpan: ref<boolean>(false),
            task_center: ref<boolean>(false),
            directory_id_move: ref<string | number>(),
            HOST: `${import.meta.env.VUE_APP_PREFIX}/mediaresourcelib-file-manager`,
            home_search: {
                type: '',
                searchText: '',
                searchImg: '',
                searchUrl: '',
                searchData: [],
                count:0
            }
        }
    },
    actions: {
        setMediaBtn (data: boolean) {
            this.media_btn = data;
        },
        setUploadModel (data: boolean) {
            this.upload_model = data;
        },
        setLocaton (data: number) {
            this.location = data;
        },
        setWangpan (data: boolean) {
            this.wangpan = data;
        },
        setTaskCenter (data: boolean) {
            this.task_center = data;
        },
        setSearch (data: any) {
            this.home_search = data;
        },
        setMoveDirectoryId (data: any) {
            this.directory_id_move = data;
        }
    }
});